﻿@{
    ViewBag.Title = "用户";
    Layout = "../Shared/_Layout.cshtml";
}
@using mscook.mvc;
@model IEnumerable<mscook.core.services.ImageSettingFactory.ImageSettingSection>

<!-- content starts -->

<div class="modal hide fade" data-href="/weblogin/platimage/edit" id="editModal">
</div>
<div class="modal hide fade" data-href="/weblogin/platimage/add" id="addModal">
</div>
<div class="modal hide fade" data-href="/weblogin/platimage/delete" id="deleteModal">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h3>确认</h3>
    </div>
    <div class="modal-body">
        <p>你确定要删除吗...</p>
    </div>
    @using (Html.BeginForm("delete", "platimage", FormMethod.Post, new { data_val = "true" }))
    { 
        <input type="hidden" id="deleteId" name="deleteId" />
        <div class="modal-footer">
            <a href="#" class="btn" data-dismiss="modal">关闭</a>
            <input type="submit" value="确定" class="btn btn-primary" />
            
        </div>
    }
</div>
<div>
    <ul class="breadcrumb">
        <li>
            <a href="#">Home</a> <span class="divider">/</span>
        </li>
        <li>
            <a href="#">Tables</a>
        </li>
    </ul>
</div>

<div class="row-fluid sortable">
    <div class="box span12">
        <div class="box-header well" data-original-title="板块图片列表">
            <h2><i class="icon-user"></i>PlatImage</h2>
            <div class="box-icon">
                <a href="#" id="add" class="btn btn-setting btn-round"><i class="icon-plus-sign"></i></a>
                <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
                <a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
            </div>
        </div>
        <div class="box-content">
            <!--<div class="row-fluid">
                <div class="span6">
                   
                </div>

            </div>-->
            <table class="table table-striped table-bordered bootstrap-datatable ">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Alias</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var platImage in Model)
                    {
                      
                        
                        <tr>
                            <td>@Html.Encode(platImage.name)</td>
                            <td>@Html.Encode(platImage.alias)</td>



                            <td class="center" data-id="@platImage.alias">
                                <!-- <a class="btn btn-success" href="#">
                                    <i class="icon-zoom-in icon-white"></i>
                                    Add                                            
                                </a>-->
                                <a class="btn btn-info" href="#">
                                    <i class="icon-edit icon-white"></i>
                                    Edit                                            
                                </a>
                                <a class="btn btn-danger" href="#">
                                    <i class="icon-trash icon-white"></i>
                                    Delete
                                </a>
                            </td>
                        </tr>
                    }

                </tbody>
            </table>

        </div>

    </div>
</div>

@section JavaScript
{
    <script type="text/javascript">
        jQuery(document).ready(function ($) {
            function formfun(item, modal, entityId, e) {

                var url = modal.attr("data-href");



                var html = $.ajax({
                    url: url,
                    global: false,
                    type: "GET",
                    data: { uid: entityId },
                    dataType: "html",
                    success: function (data) {

                        modal.html(data);
                        modal.modal('show');

                    }
                });
                e.preventDefault();
            };
            $(".btn-info").bind("click", function (e) {
                var $editModal = $("#editModal");
                var entityId = $(this).parent().attr("data-id");
                formfun($(this), $editModal, entityId, e);


            });

            $("#add").click(function (e) {//dbclick double click
                //$(".btn-info").parent().attr("data-id");
                var $addModal = $("#addModal");
                formfun(null, $addModal, null, e);

            });

            $(".btn-danger").click(function () {
                var entityId = $(this).parent().attr("data-id");
                $("#deleteId").val(entityId);
                $("#deleteModal").modal("show");
            });
        });

    </script>
}